gtk-demo/main: Suppress implicit fallthru warning
authorDaniel Boles <dboles.src@gmail.com>
Fri, 12 Oct 2018 21:09:42 +0000 (22:09 +0100)
committerDaniel Boles <dboles.src@gmail.com>
Fri, 12 Oct 2018 21:19:25 +0000 (22:19 +0100)
Comments matched to reassure the compiler that fallthrough is
intentional are supposed to precede the case or default keywords, at
least in GCC, so the one here did not suppress the warning with GCC. We
can just the if condition and put the comment at the end to solve that.

https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/

demos/gtk-demo/main.c

index 98f730ae746bd6de42fcbfd64c2c6cf2e0f9f492..ba2f1a25c16ce3c36784e52c66a44d82fceff89c 100644 (file)
@@ -831,15 +831,14 @@ load_file (const gchar *demoname,
           /* Skipping blank lines */
           while (g_ascii_isspace (*p))
             p++;
-          if (*p)
-            {
-              p = lines[i];
-              state++;
-              /* Fall through */
-            }
-          else
+
+          if (!*p)
             break;
 
+          p = lines[i];
+          state++;
+          /* Fall through */
+
         case 3:
           /* Reading program body */
           gtk_text_buffer_insert (source_buffer, &start, p, -1);